'''
 * CaRComp Execution Environment
 * 
 * Copyright (C) 2011 Taylor L. Riche
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
'''

from carcomp.directory import cameras
from carcomp.framework import system

def run_as_sys():
    sys = system.System()
    
    client_int = system.AppInterface('ft.client.as_client', 'client', True, 
                                     '-i {}ft/tests/TEST_INPUT.txt -o {}ft/tests/TEST_OUTPUT.txt'.format(cameras.local_directory.package_root, 
                                                                                                       cameras.local_directory.package_root))
    server0_int = system.AppInterface('ft.server.as_server', 'server0')
    server1_int = system.AppInterface('ft.server.as_server', 'server1')
    agree0_int = system.AppInterface('ft.agreement.as_agreement', 'agree0')
    agree1_int = system.AppInterface('ft.agreement.as_agreement', 'agree1')
    agree2_int = system.AppInterface('ft.agreement.as_agreement', 'agree2')
    
    sys.add_apps([client_int, server0_int, server1_int, agree0_int, agree1_int, agree2_int])
    
    sys.run(cameras.local_directory)
    
    sys.wait_and_end()
    
if __name__ == '__main__':
    run_as_sys()
    
    